//
//  XGFocusViewController.m
//  BSBuDeJie
//
//  Created by monkey on 2018/12/10.
//  Copyright © 2018 itcast. All rights reserved.
//

#import <Masonry/Masonry.h>

#import "XGFocusViewController.h"
#import "XGRecommendCategoryViewController.h"

#import "XGFocusView.h"

#pragma mark - XGFocusViewController

@interface XGFocusViewController ()


@end

@implementation XGFocusViewController

#pragma mark - 控制器生命周期方法

- (void)loadView
{
    [super loadView];
    
    // 设置视图层次
    [self setUpUI];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    // 设置导航栏内容
    [self setUpNavigationItem];
}

- (void)setUpNavigationItem
{
    UIButton *recommendItem = [UIButton buttonWithImageName:@"friendsRecommentIcon" highlightedImageName:@"friendsRecommentIcon-click" target:self action:@selector(recommendAction)];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:recommendItem];
}

#pragma mark - 事件监听

- (void)recommendAction
{
    XGRecommendCategoryViewController *viewController = [[XGRecommendCategoryViewController alloc] init];
    [self.navigationController pushViewController:viewController animated:YES];
}

#pragma mark  其他方法

- (void)setUpUI
{
    self.view.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.f];
    // 添加子控件
    XGFocusView *focusView = [[XGFocusView alloc] init];
    focusView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:focusView];
    
    //设置自动布局
    [focusView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.view);
        make.width.equalTo(self.view.mas_width);
        make.height.mas_equalTo(300);
    }];
}



@end




